package com.atguigu.edu.realtime.publisher.mapping;

import com.atguigu.edu.realtime.publisher.bean.VideoPlayCnt;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VideoPlayChapterCountMapper {
    @Select(" select\n" +
            " chapter_name,count(session_id) playCnt,sum(duration_sec) playTimeSum, count(distinct user_id) userCnt,\n" +
            " sum(duration_sec)/count(distinct user_id) playTimeAvg\n" +
            " from\n" +
            " dws_video_chapter_play_window\n" +
            " where toYYYYMMDD(stt) = #{date}\n" +
            " group by chapter_name;")
    List<VideoPlayCnt> selectVideoPlayCnt(Integer date);
}
